-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove abs
from DefaultQubit
#2057
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2057 +/- ##
=======================================
Coverage 99.17% 99.17%
=======================================
Files 225 225
Lines 17284 17291 +7
=======================================
+ Hits 17142 17149 +7
Misses 142 142
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was super quick, thanks @dwierichs! I agree, this is good to have fixed even with the minor overhead.
@@ -92,6 +92,7 @@ class DefaultQubitAutograd(DefaultQubit): | |||
_transpose = staticmethod(np.transpose) | |||
_tensordot = staticmethod(np.tensordot) | |||
_conj = staticmethod(np.conj) | |||
_real = staticmethod(np.real) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but we are in the process of slowly migrating the devices to qml.math
:) Not an issue here though!
Co-authored-by: Josh Izaac <josh146@gmail.com>
Thanks for the fast review! And very good idea to make the tests stable against possible default changes. :) |
Context:
This PR implements the fix to #1125 proposed in this comment
Description of the Change:
The line 792
in
qml/devices/default_qubit.py
is replaced byavoiding the usage of
abs
, which does not have a well-defined derivative at 0.Benefits:
Fixes #1125 in all interfaces.
Possible Drawbacks:
Performance, see short discussion here
Related GitHub Issues:
#1125